home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / PInterfaces / Printing.p < prev    next >
Encoding:
Text File  |  1992-01-29  |  8.8 KB  |  333 lines  |  [TEXT/MPS ]

  1.  
  2. {
  3. Created: Thursday, September 12, 1991 at 3:01 PM
  4.  Printing.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1985-1991
  8.   All rights reserved
  9. }
  10.  
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT Printing;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingPrinting}
  22. {$SETC UsingPrinting := 1}
  23.  
  24. {$I+}
  25. {$SETC PrintingIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingQuickdraw}
  28. {$I $$Shell(PInterfaces)Quickdraw.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingDialogs}
  31. {$I $$Shell(PInterfaces)Dialogs.p}
  32. {$ENDC}
  33. {$SETC UsingIncludes := PrintingIncludes}
  34.  
  35. CONST
  36. iPFMaxPgs = 128;
  37. iPrPgFract = 120;                        {Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract}
  38. iPrPgFst = 1;                            {Page range constants}
  39. iPrPgMax = 9999;
  40. iPrRelease = 3;                            {Current version number of the code.}
  41. iPrSavPFil = -1;
  42. iPrAbort = $0080;
  43. iPrDevCtl = 7;                            {The PrDevCtl Proc's ctl number}
  44. lPrReset = $00010000;                    {The PrDevCtl Proc's CParam for reset}
  45. lPrLineFeed = $00030000;
  46. lPrLFStd = $0003FFFF;                    {The PrDevCtl Proc's CParam for std paper advance}
  47. lPrLFSixth = $0003FFFF;
  48. lPrPageEnd = $00020000;                    {The PrDevCtl Proc's CParam for end page}
  49. lPrDocOpen = $00010000;
  50. lPrPageOpen = $00040000;
  51. lPrPageClose = $00020000;
  52. lPrDocClose = $00050000;
  53. iFMgrCtl = 8;                            {The FMgr's Tail-hook Proc's ctl number}
  54. iMemFullErr = -108;
  55. iIOAbort = -27;
  56. pPrGlobals = $00000944;                    {The PrVars lo mem area:}
  57. bDraftLoop = 0;
  58. bSpoolLoop = 1;
  59. bUser1Loop = 2;
  60. bUser2Loop = 3;
  61. iPrBitsCtl = 4;
  62. lScreenBits = 0;
  63. lPaintBits = 1;
  64. lHiScreenBits = $00000002;                {The Bitmap Print Proc's Screen Bitmap param}
  65. lHiPaintBits = $00000003;                {The Bitmap Print Proc's Paint [sq pix] param}
  66. iPrIOCtl = 5;
  67. iPrEvtCtl = 6;                            {The PrEvent Proc's ctl number}
  68. lPrEvtAll = $0002FFFD;                    {The PrEvent Proc's CParam for the entire screen}
  69. lPrEvtTop = $0001FFFD;                    {The PrEvent Proc's CParam for the top folder}
  70. iPrDrvrRef = -3;
  71. getRslDataOp = 4;
  72. setRslOp = 5;
  73. draftBitsOp = 6;
  74. noDraftBitsOp = 7;
  75. getRotnOp = 8;
  76. NoSuchRsl = 1;
  77. OpNotImpl = 2;                            {the driver doesn't support this opcode}
  78. RgType1 = 1;
  79.  
  80. TYPE
  81. TFeed = (feedCut,feedFanfold,feedMechCut,feedOther);
  82.  
  83. TScan = (scanTB,scanBT,scanLR,scanRL);
  84.  
  85.  
  86. TPRect = ^Rect;                            { A Rect Ptr }
  87. PrIdleProcPtr = ProcPtr;
  88. PItemProcPtr = ProcPtr;
  89.  
  90. TPPrPort = ^TPrPort;
  91. TPrPort = RECORD
  92.  gPort: GrafPort;                        {The Printer's graf port.}
  93.  gProcs: QDProcs;                        {..and its procs}
  94.  lGParam1: LONGINT;                        {16 bytes for private parameter storage.}
  95.  lGParam2: LONGINT;
  96.  lGParam3: LONGINT;
  97.  lGParam4: LONGINT;
  98.  fOurPtr: BOOLEAN;                        {Whether the PrPort allocation was done by us.}
  99.  fOurBits: BOOLEAN;                        {Whether the BitMap allocation was done by us.}
  100.  END;
  101.  
  102. { Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  103.   This is the "PrPeek" record. }
  104. TPPrInfo = ^TPrInfo;
  105. TPrInfo = RECORD
  106.  iDev: INTEGER;                            {Font mgr/QuickDraw device code}
  107.  iVRes: INTEGER;                        {Resolution of device, in device coordinates}
  108.  iHRes: INTEGER;                        {..note: V before H => compatable with Point.}
  109.  rPage: Rect;                            {The page (printable) rectangle in device coordinates.}
  110.  END;
  111.  
  112. { Print Info Record: The parameters needed for page composition. }
  113. TPPrStl = ^TPrStl;
  114. TPrStl = RECORD
  115.  wDev: INTEGER;
  116.  iPageV: INTEGER;
  117.  iPageH: INTEGER;
  118.  bPort: SignedByte;
  119.  feed: TFeed;
  120.  END;
  121.  
  122. TPPrXInfo = ^TPrXInfo;
  123. TPrXInfo = RECORD
  124.  iRowBytes: INTEGER;
  125.  iBandV: INTEGER;
  126.  iBandH: INTEGER;
  127.  iDevBytes: INTEGER;
  128.  iBands: INTEGER;
  129.  bPatScale: SignedByte;
  130.  bUlThick: SignedByte;
  131.  bUlOffset: SignedByte;
  132.  bUlShadow: SignedByte;
  133.  scan: TScan;
  134.  bXInfoX: SignedByte;
  135.  END;
  136.  
  137. TPPrJob = ^TPrJob;
  138. TPrJob = RECORD
  139.  iFstPage: INTEGER;                        {Page Range.}
  140.  iLstPage: INTEGER;
  141.  iCopies: INTEGER;                        {No. copies.}
  142.  bJDocLoop: SignedByte;                    {The Doc style: Draft, Spool, .., and ..}
  143.  fFromUsr: BOOLEAN;                        {Printing from an User's App (not PrApp) flag}
  144.  pIdleProc: PrIdleProcPtr;                {The Proc called while waiting on IO etc.}
  145.  pFileName: StringPtr;                    {Spool File Name: NIL for default.}
  146.  iFileVol: INTEGER;                        {Spool File vol, set to 0 initially}
  147.  bFileVers: SignedByte;                    {Spool File version, set to 0 initially}
  148.  bJobX: SignedByte;                        {An eXtra byte.}
  149.  END;
  150.  
  151. { Print Job: Print "form" for a single print request. }
  152. TPPrint = ^TPrint;
  153. THPrint = ^TPPrint;
  154. TPrint = RECORD
  155.  iPrVersion: INTEGER;                    {(2) Printing software version}
  156.  prInfo: TPrInfo;                        {(14) the PrInfo data associated with the current style.}
  157.  rPaper: Rect;                            {(8) The paper rectangle [offset from rPage]}
  158.  prStl: TPrStl;                            {(8)  This print request's style.}
  159.  prInfoPT: TPrInfo;                        {(14)  Print Time Imaging metrics}
  160.  prXInfo: TPrXInfo;                        {(16)  Print-time (expanded) Print info record.}
  161.  prJob: TPrJob;                            {(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120}
  162.  printX: ARRAY [1..19] OF INTEGER;        {Spare to fill to 120 bytes!}
  163.  END;
  164.  
  165. { The universal 120 byte printing record }
  166. TPPrStatus = ^TPrStatus;
  167. TPrStatus = RECORD
  168.  iTotPages: INTEGER;                    {Total pages in Print File.}
  169.  iCurPage: INTEGER;                        {Current page number}
  170.  iTotCopies: INTEGER;                    {Total copies requested}
  171.  iCurCopy: INTEGER;                        {Current copy number}
  172.  iTotBands: INTEGER;                    {Total bands per page.}
  173.  iCurBand: INTEGER;                        {Current band number}
  174.  fPgDirty: BOOLEAN;                        {True if current page has been written to.}
  175.  fImaging: BOOLEAN;                        {Set while in band's DrawPic call.}
  176.  hPrint: THPrint;                        {Handle to the active Printer record}
  177.  pPrPort: TPPrPort;                        {Ptr to the active PrPort}
  178.  hPic: PicHandle;                        {Handle to the active Picture}
  179.  END;
  180.  
  181. { Print Status: Print information during printing. }
  182. TPPfPgDir = ^TPfPgDir;
  183. THPfPgDir = ^TPPfPgDir;
  184. TPfPgDir = RECORD
  185.  iPages: INTEGER;
  186.  iPgPos: ARRAY [0..128] OF LONGINT;        {ARRAY [0..iPfMaxPgs] OF LONGINT}
  187.  END;
  188.  
  189. { PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) }
  190. TPPrDlg = ^TPrDlg;
  191. TPrDlg = RECORD
  192.  Dlg: DialogRecord;                        {The Dialog window}
  193.  pFltrProc: ModalFilterProcPtr;            {The Filter Proc.}
  194.  pItemProc: PItemProcPtr;                {The Item evaluating proc.}
  195.  hPrintUsr: THPrint;                    {The user's print record.}
  196.  fDoIt: BOOLEAN;
  197.  fDone: BOOLEAN;
  198.  lUser1: LONGINT;                        {Four longs for user's to hang global data.}
  199.  lUser2: LONGINT;                        {...Plus more stuff needed by the particular printing dialog.}
  200.  lUser3: LONGINT;
  201.  lUser4: LONGINT;
  202.  END;
  203.  
  204.  
  205. PDlgInitProcPtr = ProcPtr;
  206.  
  207. TGnlData = RECORD
  208.  iOpCode: INTEGER;
  209.  iError: INTEGER;
  210.  lReserved: LONGINT;                    {more fields here depending on call}
  211.  END;
  212.  
  213. TRslRg = RECORD
  214.  iMin: INTEGER;
  215.  iMax: INTEGER;
  216.  END;
  217.  
  218. TRslRec = RECORD
  219.  iXRsl: INTEGER;
  220.  iYRsl: INTEGER;
  221.  END;
  222.  
  223. TGetRslBlk = RECORD
  224.  iOpCode: INTEGER;
  225.  iError: INTEGER;
  226.  lReserved: LONGINT;
  227.  iRgType: INTEGER;
  228.  xRslRg: TRslRg;
  229.  yRslRg: TRslRg;
  230.  iRslRecCnt: INTEGER;
  231.  rgRslRec: ARRAY [1..27] OF TRslRec;
  232.  END;
  233.  
  234. TSetRslBlk = RECORD
  235.  iOpCode: INTEGER;
  236.  iError: INTEGER;
  237.  lReserved: LONGINT;
  238.  hPrint: THPrint;
  239.  iXRsl: INTEGER;
  240.  iYRsl: INTEGER;
  241.  END;
  242.  
  243. TDftBitsBlk = RECORD
  244.  iOpCode: INTEGER;
  245.  iError: INTEGER;
  246.  lReserved: LONGINT;
  247.  hPrint: THPrint;
  248.  END;
  249.  
  250. TGetRotnBlk = RECORD
  251.  iOpCode: INTEGER;
  252.  iError: INTEGER;
  253.  lReserved: LONGINT;
  254.  hPrint: THPrint;
  255.  fLandscape: BOOLEAN;
  256.  bXtra: SignedByte;
  257.  END;
  258.  
  259. TPBitMap = ^BitMap;                        { A BitMap Ptr }
  260.  
  261. TN = 0..15;                                { a Nibble }
  262.  
  263. TPWord = ^TWord;
  264. THWord = ^TPWord;
  265. TWord = PACKED RECORD
  266.  CASE INTEGER OF
  267.    0:
  268.   (c1,c0: CHAR);
  269.    1:
  270.   (b1,b0: SignedByte);
  271.    2:
  272.   (usb1,usb0: Byte);
  273.    3:
  274.   (n3,n2,n1,n0: TN);
  275.    4:
  276.   (f15,f14,f13,f12,f11,f10,f9,f8,f7,f6,f5,f4,f3,f2,f1,f0: BOOLEAN);
  277.    5:
  278.   (i0: INTEGER);
  279.  END;
  280.  
  281. TPLong = ^TLong;
  282. THLong = ^TPLong;
  283. TLong = RECORD
  284.  CASE INTEGER OF
  285.    0:
  286.   (w1,w0: TWord);
  287.    1:
  288.   (b1,b0: LONGINT);
  289.    2:
  290.   (p0: Ptr);
  291.    3:
  292.   (h0: Handle);
  293.    4:
  294.   (pt: Point);
  295.  END;
  296.  
  297.  
  298. PROCEDURE PrPurge;
  299. PROCEDURE PrNoPurge;
  300. PROCEDURE PrOpen;
  301. PROCEDURE PrClose;
  302. PROCEDURE PrintDefault(hPrint: THPrint);
  303. FUNCTION PrValidate(hPrint: THPrint): BOOLEAN;
  304. FUNCTION PrStlDialog(hPrint: THPrint): BOOLEAN;
  305. FUNCTION PrJobDialog(hPrint: THPrint): BOOLEAN;
  306. FUNCTION PrStlInit(hPrint: THPrint): TPPrDlg;
  307. FUNCTION PrJobInit(hPrint: THPrint): TPPrDlg;
  308. PROCEDURE PrJobMerge(hPrintSrc: THPrint;hPrintDst: THPrint);
  309. FUNCTION PrDlgMain(hPrint: THPrint;pDlgInit: PDlgInitProcPtr): BOOLEAN;
  310. FUNCTION PrOpenDoc(hPrint: THPrint;pPrPort: TPPrPort;pIOBuf: Ptr): TPPrPort;
  311. PROCEDURE PrCloseDoc(pPrPort: TPPrPort);
  312. PROCEDURE PrOpenPage(pPrPort: TPPrPort;pPageFrame: TPRect);
  313. PROCEDURE PrClosePage(pPrPort: TPPrPort);
  314. PROCEDURE PrPicFile(hPrint: THPrint;pPrPort: TPPrPort;pIOBuf: Ptr;pDevBuf: Ptr;
  315.  VAR prStatus: TPrStatus);
  316. FUNCTION PrError: INTEGER;
  317. PROCEDURE PrSetError(iErr: INTEGER);
  318. PROCEDURE PrGeneral(pData: Ptr);
  319. PROCEDURE PrDrvrOpen;
  320. PROCEDURE PrDrvrClose;
  321. PROCEDURE PrCtlCall(iWhichCtl: INTEGER;lParam1: LONGINT;lParam2: LONGINT;
  322.  lParam3: LONGINT);
  323. FUNCTION PrDrvrDCE: Handle;
  324. FUNCTION PrDrvrVers: INTEGER;
  325.  
  326.  
  327. {$ENDC} { UsingPrinting }
  328.  
  329. {$IFC NOT UsingIncludes}
  330.  END.
  331. {$ENDC}
  332.  
  333.